<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>简单计算器</title>
</head>
<body>
    <input type="text" id="value1">
    <select name="" id="sect">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" id="value2">
    <input type="button" id="btn" value="计算">
    <input type="text" id="result">
</body>
<script>
var value1=document.getElementById("value1");
var sect=document.getElementById("sect");
var value2=document.getElementById("value2");
var result=document.getElementById("result");
var btn=document.getElementById("btn");
console.log(value1,sect,value2,result,btn);
btn.onclick=function (){
    var num1=Number(value1.value);
    var sectvalue=sect.value;
    var num2=Number(value2.value);
    var a=""
    if(sectvalue=="+"){
        a=num1+num2;
    }
    else if(sectvalue=="-"){
        a=num1-num2;
    }
    else if(sectvalue=="*"){
        a=num1*num2;
    }
    else{
        a=num1/num2
    }
    result.value=a;
}
</script>
</html>